import { registerControlProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { App } from 'vue';
import { OdooDRbarControl } from './odoo-drbar';
import { OdooDRbarProvider } from './odoo-drbar.provider';

export const IBizOdooDRbarControl = withInstall(
  OdooDRbarControl,
  function (v: App) {
    v.component(OdooDRbarControl.name!, OdooDRbarControl);
    registerControlProvider('CUSTOM_ODOO_DRBAR', () => new OdooDRbarProvider());
  },
);

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: App) {
    app.use(IBizOdooDRbarControl);
  },
};
